package com.solocredit.finance.ui.user.adapter

import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView
import com.solocredit.finance.R
import com.solocredit.finance.base.adapter.MullaRecyclerViewAdapter
import com.solocredit.finance.base.adapter.MullaViewHolderHelper
import org.json.JSONObject

/**
 * MullaFlow
 * @Author wwdeng
 * @CreateTime: 2024/7/31 16:42
 * @Annotation：手机号校验类型
 */
class MullaUserVerificationTypeAdapter(recyclerView: RecyclerView?) : MullaRecyclerViewAdapter<JSONObject>(recyclerView, R.layout.item_mulla_verification_type) {
    override fun setItemChildListener(helper: MullaViewHolderHelper, viewType: Int) {
        helper.setItemChildClickListener(R.id.itemLayout)
    }

    override fun fillData(helper: MullaViewHolderHelper, position: Int, model: JSONObject) {
        helper.setText(R.id.textTypeTitle,model.optString("title"))
        val itemLayout = helper.getView<LinearLayout>(R.id.itemLayout)
        val imgTypeSelect = helper.getImageView(R.id.imgTypeSelect)
        if (model.optBoolean("isSelected",false)){
            itemLayout.setBackgroundResource(R.drawable.mulla_radius_frame_ffd21034_fill_fffff4f4_12)
            imgTypeSelect.setImageResource(R.mipmap.mulla_verification_type_selected_icon)
        } else {
            itemLayout.setBackgroundResource(R.drawable.mulla_radius_frame_ffdfdfdf_fill_fff9f9f9_12)
            imgTypeSelect.setImageResource(R.mipmap.mulla_verification_type_normal_icon)
        }
    }
}